
"""
当前章节的文笔写作分析
"""
from models import Chapter
from pydantic import Field
from core.utils import BaseAnalyzer, prompt_dir


class StyleAnalyzer(BaseAnalyzer):

    def __init__(self):
        super().__init__(prompt_file= prompt_dir / 'alone/a2. 文笔写作分析.md')

    def invoke(
            self,
            chapter: Chapter = Field(description="章节信息")
    ):
        prompt = self.template_prompt.format(
            inputs={
                "chapter_content": chapter.chapter_content
            },
            remove_template_variables=True
        )
        chapter.writing_style = self.analyze(prompt)
        return chapter.writing_style
